import {Injectable} from '@angular/core';
import {environment} from '../../environments/environment';

@Injectable()

export class ConfigService {

    imgHostname: string;
    shareHostname: string;
    hostname: string;

    constructor() {
        if (environment.production) {
            this.productionConfig();
        } else {
            this.defaultDevelopmentConfig();
        }
    }

    private defaultDevelopmentConfig() {
        // this.hostname = 'http://192.168.1.199:8080/api/v1'; // 本地
        this.hostname = 'http://192.168.1.75:8000'; // 广辉
        this.hostname = 'http://192.168.1.222:8000'; // 广辉
        // this.hostname = 'http://47.92.200.205:8000'; // 广辉
        this.imgHostname = 'http://192.168.1.188:9092';
        this.shareHostname = '';
    }

    private productionConfig() {
        this.hostname = 'http://123.206.50.200:9529/api/v1';
        this.imgHostname = 'http://123.206.50.200:9092';
        this.shareHostname = '';
    }

    public fetchFromIconfontConfig() {
        return {scriptUrl: '//at.alicdn.com/t/font_694908_3qv9uuxdexm.js'};
    }
}
